(function(jQuery) {
	/*
	 * 配置表版本查询放大镜JS插件
	 */

	var gridColMenu_Detail = null;

	$.MagnifierPZBBBUtils = {
		/**
		 * 页面初始化函数
		 */
		init : function() {
			var bbname = encodeURI($('#condition').val());
			var bnameflag = encodeURI($('#magnifierPZBBBPage_i_bnameflag').val());
			
			var url1="";
			if(bnameflag!=null&&bnameflag!=""){
				url1 = 'magnifier/getMagnifierPZBBBList.do?catch='
					+ new Date() 
				+ '&bbname='
				+ bbname+'&bnameflag='+bnameflag + '&Login_SessionId=' + sessionId
			}else{
				url1 = 'magnifier/getMagnifierPZBBBList.do?catch='
					+ new Date() 
				+ '&bbname='
				+ bbname+ '&Login_SessionId=' + sessionId
			}
				
			// 创建列表DataGrid
			$('#magnifierPZBBBPage_pzbbb')
					.datagrid(
							{
								url : url1,
								method : 'get',
								title : $.i18n.prop("js.magnifier.title.pzbbb"),
								iconCls : 'icon-large-smartart',
								pagination : true,
								rownumbers : true,
								striped : true,
								pageSize : 10,
								pageList : [10],
								idField:'bbId',
								columns : [ [ {
									field : 'name',
									title : $.i18n.prop("js.magnifier.datagrid.pzbmc"),
									width : 200,
									align : 'left'
								}, {
									field : 'bbname',
									title : $.i18n.prop("js.magnifier.datagrid.pzbbbmc"),
									width : 233,
									align : 'left'
								} ] ],

								onDblClickRow : function(rowIndex, rowData) {
									//向父页面赋值
									if(null!=$('#magnifierPZBBBPage_name').val()&&$('#magnifierPZBBBPage_name').val().length>0){
										$("#" + $('#magnifierPZBBBPage_name').val()).val(rowData.name);
									}
									if(null!=$('#magnifierPZBBBPage_bbId').val()&&$('#magnifierPZBBBPage_bbId').val().length>0){
										$("#" + $('#magnifierPZBBBPage_bbId').val()).val(rowData.bbId);
									}
									if ($('#magnifierPZBBBPage_bbname').val() != null && $('#magnifierPZBBBPage_bbname').val().length > 0) {
										$("#" + $('#magnifierPZBBBPage_bbname').val(),
												window.parent.document).searchbox(
												'setValue', rowData.bbname);
									}
									//关闭放大镜窗口
									$("#magnifier_window").window('close');
								},
								onLoadError: function(){
									$.LmisUtils.opLoadError();
								}
							});
		},

		/**
		 * 查询
		 */
		search : function() {
			var bbname = encodeURI($('#condition').val());
			var bnameflag = encodeURI($('#magnifierPZBBBPage_i_bnameflag').val());
			
			var url1="";
			if(bnameflag!=null&&bnameflag!=""){
				url1 = 'magnifier/getMagnifierPZBBBList.do?catch='
					+ new Date() 
				+ '&bbname='
				+ bbname+'&bnameflag='+bnameflag + '&Login_SessionId=' + sessionId
			}else{
				url1 = 'magnifier/getMagnifierPZBBBList.do?catch='
					+ new Date() 
				+ '&bbname='
				+ bbname + '&Login_SessionId=' + sessionId
			}
			$('#magnifierPZBBBPage_pzbbb')
					.datagrid(
							{
								url : url1
							});
		}
	};
})(jQuery);
$.MagnifierPZBBBUtils.init();
